﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace Possan.ZipFolders
{
    public class FolderConfig
    {
        public List<Folder> Folders;

        public FolderConfig()
        {
            Folders = new List<Folder>();
        }

        public bool Parse(XmlNode obj)
        {
            bool ok = false;
            XmlNodeList foldernodes = obj.SelectNodes("Folder");

            log4net.ILog l = log4net.LogManager.GetLogger("Possan.ZipFolders");
            l.Debug("Found " + foldernodes.Count + " folders.");

            for (int k = 0; k < foldernodes.Count; k++)
            {
                Folder f = Folder.Parse(foldernodes[k] );
                if( f != null )
                    Folders.Add(f);
            }

            return ok;
        }
    }

}
